// 广义的mixin功能
function mixin(target, ...mixins) { // target需要是函数，有原型;
  const newObj = target;
  newObj.prototype = Object.create(target.prototype);
  mixins.forEach((mixin) => {
    for(let prop in mixin) {
      if (mixin.hasOwnProperty(prop)) {
        newObj.prototype[prop] = mixin[prop];
      }
    }
  });
  return newObj;
}

export default mixin;
